package com.demo.admin.web.api;

import jakarta.validation.Valid;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.demo.admin.domain.param.OauthTokenParam;
import com.demo.admin.domain.result.OauthTokenResult;
import com.demo.admin.service.OauthService;
import com.demo.common.domain.vo.BaseResult;



/**
 * OauthApi
 * 
 * @author demo
 * @data 2022-02-26 22:37:33
 */
@RestController
@RequestMapping(value = "/oauth")
public class OauthApi {
    @Autowired
    private OauthService oauthService;

    /**
     * 获取token
     * 
     * @author demo
     */
    @RequestMapping(value = "/token", method = {RequestMethod.GET, RequestMethod.POST})
    public BaseResult<OauthTokenResult> token(@Valid OauthTokenParam param) {
        return BaseResult.success(oauthService.token(param));
    }

}
